/**
 * 
 */
package com.csc.bankingsystem.core.dao.impl;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.csc.bankingsystem.core.dao.UserInfoDAO;
import com.csc.bankingsystem.core.entity.TransferRecord;
import com.csc.bankingsystem.core.entity.UserInfo;

/**
 * 
 * Define all Data access operations of UserInfoDAO
 * 
 * @author angelkid
 *
 */
@Repository("userInfoDAO")
public class UserInfoDAOImpl extends GenericDAOImpl<UserInfo> implements
		UserInfoDAO {

	@SuppressWarnings("unchecked")
	public UserInfo getUserInfoByLoginId(String loginId) {
		Criteria criteria = getSession().createCriteria(UserInfo.class);
		criteria.add(Restrictions.eq("loginId", loginId));
		List<UserInfo> list = criteria.list();
		return (CollectionUtils.isEmpty(list))?null:list.get(0);
	}

}
